<%@page import="youleche.com.caches.CacheFactory"%>
<%@page import="youleche.com.model.MVehicleImageInfo"%>
<%@page import="youleche.com.model.MArea"%>
<%@page import="youleche.com.external.IpToCityServlet"%>
<%@page import="youleche.com.controler.controler.PageDataForBussinessControler"%>
<%@page import="youleche.com.model.MVehicleInfo"%>
<%@page import="java.util.List"%>
<%@page import="youleche.com.business.BVehicleInfo"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>优乐车-全国最大的车辆信息交易平台</title>
<link rel="stylesheet" href="/meileche/FlexSlider/flexslider.css" media="screen" />

<link rel="stylesheet" href="css/search.css"/>
<script type="text/javascript" src="js/common/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/common/jquery.cookie.js"></script>
<script type="text/javascript" src="/meileche/FlexSlider/jquery.flexslider-min.js"></script>
<script type="text/javascript" src="/meileche/layer/layer.js"></script>
<script type="text/javascript" src="js/search.js"></script>
<script type="text/javascript">
	
	
	function clearAddress(){
		$("#txtAddress").val('');
	}
	
	window.onload = function() {
		var userName = $.cookie('u0.ulezu.com');
		if(userName != null){
			$("#linkUserName").html(userName).css("background-color", "#ccc");
			$("#loginandregister").hide();
		}
	};
	
	$(window).load(function() { 
		$('.flexslider').flexslider({  
			 animation: "slide"
		});
	});
	
	function contactSeller(vehicleId){
		$.layer({
		    type: 2,
		    title: "联系店主（迷人车-全国最大的车辆信息交易平台）",
		    iframe: {src: '/meileche/che.do?id=' +vehicleId+'&action=4'},
		    area : ['1000px' , '500px'],
		    success : function(){
		        layer.shift('right', 400);	
		    }
		});
	}
</script>
</head>
<body>
	<% String city = IpToCityServlet.getCityByIpForHome(IpToCityServlet.getIpAddr(request)); %>
	<% 
		List<MVehicleImageInfo> homelist = PageDataForBussinessControler.getHomeImageInfoForLunBo();
		if(homelist == null){
			return;
		}
	%>
	<div class="body">
		<div class="backgroundBody">
			<div class="top">
				<div class="topTitle">
					<div style="width: 400px; height: 80px; float: left;">
						<img src="/meileche/image/ylc_logo.jpg" />
					</div>
					<div style="width: 600px; height: 80px; float: left;">
						<div
							style="width: 200px; height: 30px; float: left; color: #444; font-size: 14px;">
								<br/>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><%= city %></b>[切换城市]
								<br/>
								<br/>
						全国最大的车辆信息交易平台</div>
						<div style="width: 150px; height: 80px; float: left;padding-top: 30px;">
									<a class="detail-btn2" href="list.jsp">发布信息</a>
						</div>
						<div
							style="width: 250px; height: 30px; float: left; padding-top: 50px; color: #444; font-size: 18px;"
							align="right">
							<span id="userName"><a id="linkUserName"></a></span><span id="loginandregister"><a href="login.jsp" id="linkLogin">登陆</a>&nbsp;|&nbsp;<a href="register.jsp" id="linkRegister">注册</a></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="help.jsp">帮助</a>
						</div>
					</div>
				</div>
			</div>
			<div class="topNavigate">
				<div style="margin-left:auto;margin-right:auto;width:1000px;height:100%;">
					<div class="daohangDiv">
						商城
					</div>
					<div class="daohangDiv">
						租车
					</div>
					<div class="daohangDiv">
						电动车
					</div>
					<div class="daohangDiv">
						自行车
					</div>
					<div class="daohangDiv1">
						
					</div>
					<div class="daohangDiv1">
						
					</div>
					<div class="daohangDiv1">
						
					</div>
					<div class="daohangDiv1">
						
					</div>
					<div class="daohangDiv1">
						
					</div>
					<div class="gouwucheDaohang" id="btnGouwuche" onclick="forwardShop();">
						<div style="float:left;height:46px;padding-top:10px;"><img src="/meileche/image/gouwuche_small.jpg"/></div>
						<div style="float:left;height:46px;padding-top:4px;text-align:center;width:70px;">&nbsp;收藏车<br/>&nbsp;(<span id="numShopSmall">0</span>)</div>
						
					</div>
				</div>
			</div>
		</div>
		<div class="mainBody">
			<div class="area">
				<div class="areaSearch">
					<div class="state" align="center">寻找迷人中的车辆</div>
					<div class="houseNum" align="center">
						<span>123</span>座城市 <span><%=PageDataForBussinessControler.getSellerForCount()%></span>个商家 <span><%= PageDataForBussinessControler.getVehicleNameForCount() %></span>个品牌
					</div>
					<input type="text" id="txtAddress" class="txtAddress"
						value="请输入品牌"  onmousedown="clearAddress();"/><br />
					<div
						style="float: left; width: 89px; margin-right: 9px; margin-top: 5px; font-size: 15px; font-weight: bold; color: #037b00;"
						align="right">
						<label> 热门位置:</label>
					</div>
					<div style="float: left; width: 278px;height:80px;" class="address">
					<%
						List<MArea> list = PageDataForBussinessControler.getHotAreaByCity(city);
						if(list != null){
							for(int i=0; i< list.size();i++){%>
								<div style="width:90px;line-height:24px;float:left;"><a><%= list.get(i).getAreaName() %></a></div>
							
						<%
							if(i == 7){%>
								<div style="width:90px;line-height:24px;float:left;"><a>更多>></a></div>
								<%
								break;
							}else{
								continue;
							}
							}
						}
					%>
						 
					</div>
					<br /> <input type="hidden" id="hidAdd" value="none"/><input type="button" class="btnSearch" value="立即搜索" onclick="search();" />
				</div>
				<div class="areaImg">
					<section class="slider">
					<div class="flexslider">
						<ul class="slides"> 
						   <%
							for(MVehicleImageInfo img : homelist){%>
								<li> <img src="<%=img.getImagePath() %>" /></li>
							<%}
						%>
						</ul>
					</div>
					</section>
				</div>				
			</div>
			<div class="cityArea">迷人车信息</div>
			<div class="main">
				<div class="mainCenter" id="mainCenter">
        <!-- 信息显示开始 -->			
        <%
        	List<MVehicleInfo> vehicleInfos = null;
        	try{
        		
        		vehicleInfos = (List<MVehicleInfo> )CacheFactory.getVehicleCache().getCache();
        	}catch(Exception ex){
        		
        	}
        %>
				<%
				if(vehicleInfos != null && vehicleInfos.size() > 0){
					for(int i = 0; i < vehicleInfos.size(); i++) {				
				%>
					<div class="mainCenterArea" id="mainCenterDiv<%=i%>">
						<div class="mainCenterAreaImg">
							<img src="image/fangwu.jpg" />
						</div>
						<div class="mainCenterAreaDesc">
							<div
								style="float: left; width: 385px; color: #333333; font-weight: bold; font-size: 20px; height: 50px; margin: 5px 0px 0px 15px; vertical-align: middle;">
								【<%= vehicleInfos.get(i).getVehicleName() %>】<%= vehicleInfos.get(i).getA1() %></div>
							<div
								style="float: left; width: 85px; height: 50px; margin: 5px 0px 0px 15px; color: #47B689;">
								[<a
									style="color: #47B689; font-size: 12px; text-decoration: underline;">查看地图</a>]
							</div>
							<div
								style="text-align:right;float: left; width: 100px; height: 25px; font-weight: bold; color: #666; font-size: 14px;">
								店铺地址：</div>
							<div
								style="float: left; width: 400px; height: 25px; color: #666;">
								<%= vehicleInfos.get(i).getA2() %></div>
							<div
								style="text-align:right;float: left; width: 100px; height: 25px; font-weight: bold; color: #666; font-size: 14px;">
								电池：</div>
							<div
								style="float: left; width: 200px; height: 25px; color: #666;">
								<%= vehicleInfos.get(i).getBatterySize() %>V<%= vehicleInfos.get(i).getElectricitySize() %>A</div>
							<div style="float: right; width: 200px; height: 235px;">
								<div
									style="float: left; width: 70px; height: 35px; text-align: right; font-size: 14px;">发布时间：</div>
								<div
									style="float: left; width: 130px; height: 35px; text-align: left;"><%= vehicleInfos.get(i).getAddTime() %></div>
								<div style="float: left; width: 200px; height: 140px;">
									<div
										style="float: left; width: 50px; height: 140px; text-align: right; line-height: 90px; vertical-align: text-top; font-size: 20px; font-style: italic; color: #444;">￥</div>
									<div
										style="float: left; width: 150px; height: 140px; text-align: left; line-height: 110px; font-size: 50px; color: #F60;"><%= vehicleInfos.get(i).getPrice() %></div>
									
								</div>
								<div style="float: left; width: 200px; height: 60px;">
									<a class="detail-btn1" onclick="contactSeller('<%= vehicleInfos.get(i).getVehicleId()%>');">联系店主</a>
								</div>
							</div>
							<div
								style="text-align:right;float: left; width: 100px; height: 25px; font-weight: bold; color: #666; font-size: 14px;">
								蓄电行程：</div>
							<div
								style="float: left; width: 200px; height: 25px; color: #666;">
								<%= vehicleInfos.get(i).getWorkLength() %>km</div>
							<div
								style="text-align:right;float: left; width: 100px; height: 25px; font-weight: bold; color: #666; font-size: 14px;">
								最大速度：</div>
							<div
								style="float: left; width: 200px; height: 25px; color: #666;">
								<%=vehicleInfos.get(i).getMaxSpeed() %>km/h</div>
							<div
								style="text-align:right;float: left; width: 100px; height: 25px; font-weight: bold; color: #666; font-size: 14px;">
								赠送：</div>
							<div
								style="float: left; width: 200px; height: 100px; color: #666;">
								雨衣、 充电器、锁</div>
							<div style="float: left; width: 300px; height: 50px">
								<a class="detail-btn" onclick="addShopVehicle('<%=vehicleInfos.get(i).getVehicleId()%>');">加入收藏车</a> <a
									class="detail-btn" href="/meileche/che.do?id=<%=vehicleInfos.get(i).getVehicleId()%>&action=1" target="_blank">车辆详情</a>
							</div>
						</div>
					</div>
				<%}}%>
			<!-- 信息显示结束 -->		
				</div>
				
			<div style="text-align:center;color:#999;font-size:14px;position:absolute;cursor:pointer;width:150px;" id="gouwuche"  onclick="forwardShop();">
				<img src="/meileche/image/gouwuche.jpg" alt="进去收藏车"/>
				<br/>
				(<span id="numShop">0</span>)辆车
			</div>
			</div>
			<div class="bottom">
				<div style="width: 150px; float: left; margin-top: 10px;">
					<ul>
						<li class="liHeader">关于我们</li>
						<li><a href="aboutme.jsp">迷人车简介</a></li>
						<li>联系我们</li>
						<li>合作伙伴</li>
					</ul>
				</div>
				<div style="width: 150px; float: left; margin-top: 10px;">
					<ul>
						<li class="liHeader">加入我们</li>
						<li><a href="gy.jsp">车源伙伴</a></li>
						<li>迷人车开源世界</li>
					</ul>
				</div>
				<div style="width: 150px; float: left; margin-top: 10px;">
					<ul>
						<li class="liHeader">网站条款</li>
						<li><a href="vip.jsp">会员条款</a></li>
						<li>社区指南</li>
						<li>版权声明</li>
						<li><a href="exemption.jsp">免责声明</a></li>
					</ul>
				</div>
				<div style="width: 150px; float: left; margin-top: 10px;">
					<ul>
						<li class="liHeader">帮助中心</li>
						<li>新手上路</li>
						<li>使用帮助</li>
						<li>建议和投诉</li>
						<li>网站地图</li>
					</ul>
				</div>
				<div style="width: 150px; float: left; margin-top: 10px;">
					<ul>
						<li class="liHeader">关注我们</li>
						<li><a>商家入口</a></li>
						<li><a href="/meileche/alogin.jsp" target="_blank">管理员</a></li>
					</ul>
				</div>
				<div style="width: 250px; float: left; margin-top: 10px;"></div>
			</div>
		</div>
	</div>
	
	
	
</body>
</html>
